package work01;

import java.util.Random;
import java.util.Arrays;

public class work8CopyArray {
    public static void main(String[] args) {
        Integer[] arr = {1, 2, 3, 4, 5};
        Integer[] arr1 = {6, 7, 8, 9, 10};
        Integer[] arrCopy = Arrays.copyOf(arr, arr.length);

        Random random = new Random();
        for (int i = 0; i < arrCopy.length; i++) {
            if (random.nextBoolean()) {
                arrCopy[i] = arr1[i];
            }
        }

        System.out.println(Arrays.toString(arr));
        System.out.println(Arrays.toString(arr1));
        System.out.println(Arrays.toString(arrCopy));
    }
}
